// 管理员商家信息
module.exports = (app) => {
  const mongoose = app.mongoose;
  mongoose.pluralize(null); //去除集合后的s
  const Schema = mongoose.Schema;
  const AdminSchema = new Schema(
    {
      //logo
      logo: { type: String, default: "" },
      // 商家名称
      name: { type: String, default: "" },
      // 账户
      username: { type: String, required: true, trim: true }, //去除空格
      // 密码
      password: { type: String, required: true, select: false }, //secret:查询时将该字段排除
      // 联系地址
      address: { type: String, default: "" },
      // 坐标
      cooperation: { type: [Number], default: [] },
      // 介绍
      introduction: { type: String, default: "" },
      // 起送价
      initialPrice: { type: Number, default: 0 },
      // 营业时间
      businessTime: { type: [String], default: [""] },
    },
    { versionKey: false, timestamps: true }
  );
  return mongoose.model("Admininfo", AdminSchema);
};
